<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.7.8/dist/vue.js" type="text/javascript"></script>
</head>
<body>
    <div id="box">
        姓：<input type="text" placeholder="请输入你的姓" v-model="firstName"><br>
        名：<input type="text" placeholder="请输入你的名" v-model="lastName"><br>
        <p>你的姓名：{{fullName()}}</p>
    </div>

    <script>
        Vue.config.productionTip = false;  //阻止vue在启动时生成生产提示
        //创建实例
        let vm = new Vue({
            el:"#box",
            data:{
                firstName:"苏",
                lastName:"凉"
            },
            methods:{
                fullName(){
                    a = this.firstName;
                    b = this.lastName;
                    return a +'-' + b;
                }
            }
        })
       
    </script>
</body>
</html>